﻿using System.Collections.Generic;
using cludg.Services.Security.Permissions;
using cludg.Domain.Users;

namespace cludg.Web.Permissions
{
	public class StoryPermissionProvider : IPermissionProvider
	{
		protected readonly List<Permission> Permissions = new List<Permission>();

		public StoryPermissionProvider()
			: base()
		{
			Permissions.Add(new RoleBasedPermission { Caption = "Смотреть истории", Name = "ViewStories", Roles = Roles.All });
			Permissions.Add(new RoleBasedPermission { Caption = "Рассказать историю", Name = "AddStory", Roles = Roles.AuthorAndAdmin });
			Permissions.Add(new RoleBasedPermission { Caption = "Комментировать историю", Name = "CommentStory", Roles = Roles.NotAnonymouse });
			Permissions.Add(new RoleBasedPermission { Caption = "Изменить комментарий", Name = "ManageComment", Roles = Roles.Admins });
			Permissions.Add(new RoleBasedPermission { Caption = "Смотреть коментарии", Name = "ViewStoryComments", Roles = Roles.All });
			Permissions.Add(new RoleBasedPermission { Caption = "Редактировать историю", Name = "EditStory", Roles = Roles.Admins });
			Permissions.Add(new AuthorPermission { Caption = "Редактировать историю", Name = "EditStory" });
			Permissions.Add(new RoleBasedPermission { Caption = "Удалить историю", Name = "DeleteStory", Roles = Roles.Admins });
			Permissions.Add(new AuthorPermission { Caption = "Удалить историю", Name = "DeleteStory" });
		}

		public IEnumerable<Permission> GetPermissions()
		{
			return Permissions;
		}
	}
}